package cn.iocoder.an.module.mold.dal.mysql.rechecktobe;

import java.util.*;

import cn.iocoder.an.framework.common.pojo.PageResult;
import cn.iocoder.an.framework.mybatis.core.query.LambdaQueryWrapperX;
import cn.iocoder.an.framework.mybatis.core.mapper.BaseMapperX;
import cn.iocoder.an.module.mold.dal.dataobject.rechecktobe.RecheckTobeDO;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Mapper;
import cn.iocoder.an.module.mold.controller.admin.rechecktobe.vo.*;
import org.apache.ibatis.annotations.Param;

/**
 * 待复检 Mapper
 *
 * @author ykk
 */
@Mapper
public interface RecheckTobeMapper extends BaseMapperX<RecheckTobeDO> {

    default PageResult<RecheckTobeDO> selectPage(RecheckTobePageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<RecheckTobeDO>()
                .eqIfPresent(RecheckTobeDO::getAccountId, reqVO.getAccountId())
                .eqIfPresent(RecheckTobeDO::getDrawingNoId, reqVO.getDrawingNoId())
                .eqIfPresent(RecheckTobeDO::getRecheckId, reqVO.getRecheckId())
                .betweenIfPresent(RecheckTobeDO::getLastRecheckTime, reqVO.getLastRecheckTime())
                .eqIfPresent(RecheckTobeDO::getIfTmp, reqVO.getIfTmp())
                .eqIfPresent(RecheckTobeDO::getStatus, reqVO.getStatus())
                .eqIfPresent(RecheckTobeDO::getTaskId, reqVO.getTaskId())
                .eqIfPresent(RecheckTobeDO::getItemId, reqVO.getItemId())
                .betweenIfPresent(RecheckTobeDO::getCreateTime, reqVO.getCreateTime())
                .eqIfPresent(RecheckTobeDO::getRemindF, reqVO.getRemindF())
                .orderByDesc(RecheckTobeDO::getId));
    }

    @Delete("DELETE FROM mold_recheck_tobe WHERE id = #{id}")
    int forceDeleteById(@Param("id") Long id);
}